import type {
  BaseProps,
  inputProps,
  selectProps
} from "@/components/AuForm/type";
import { DEVICE_TYPE_ENUM, FACTORY_TYPE_LIST } from "@/utils/constants";

export const DEVICE_TYPES = [
  {
    label: "device_update.form.all_devices",
    value: ""
  },
  ...FACTORY_TYPE_LIST
];

export const SOFTWARE_TYPES = [
  {
    label: "device_update.form.chinese_ui",
    value: 1,
    type: DEVICE_TYPE_ENUM.MAKE_TEA
  },
  {
    label: "device_update.form.video_version",
    value: 2,
    type: DEVICE_TYPE_ENUM.MAKE_TEA
  }
];

type FormListProp = [
  selectProps,
  // inputProps,
  // inputProps,
  selectProps,
  selectProps,
  selectProps,
  inputProps,
  BaseProps,
  BaseProps,
  inputProps,
  BaseProps,
  inputProps,
  inputProps
];

export const SEARCH_FORM_LIST = [
  {
    type: "select",
    key: "business_id",
    label: "device_update.form.business",
    placeholder: "device_update.form.business_placeholder",
    options: [],
    labelKey: "brand",
    valueKey: "id"
  },
  {
    type: "select",
    key: "device_type",
    label: "device_update.form.device_type",
    placeholder: "device_update.form.device_type_placeholder",
    options: DEVICE_TYPES,
    emptyValues: [null, undefined],
    labelKey: "label",
    valueKey: "value",
    defaultValue: ""
  }
];

export const FORM_LIST: FormListProp = [
  {
    type: "select",
    key: "business_id",
    label: "device_update.form.business",
    placeholder: "device_update.form.business_placeholder",
    options: [],
    labelKey: "brand",
    valueKey: "id",
    required: true
  },
  {
    type: "select",
    key: "device_type",
    label: "device_update.form.device_type",
    placeholder: "device_update.form.device_type_placeholder",
    options: DEVICE_TYPES,
    emptyValues: [null, undefined],
    labelKey: "label",
    valueKey: "value",
    defaultValue: "",
    required: true
  },
  {
    type: "select",
    key: "type",
    label: "device_update.form.software_type",
    placeholder: "device_update.form.software_type_placeholder",
    options: [],
    labelKey: "label",
    valueKey: "value",
    defaultValue: ""
  },
  {
    type: "select",
    key: "board_version",
    label: "device_update.form.firmware_version",
    placeholder: "device_update.form.firmware_version_placeholder",
    options: [],
    emptyValues: [null, undefined],
    labelKey: "board_version",
    valueKey: "board_version",
    defaultValue: "",
    multiple: true,
    multipleLimit: 3
  },
  {
    type: "input",
    key: "device_model",
    label: "device_update.form.device_model",
    placeholder: "device_update.form.device_model_placeholder"
  },
  {
    type: "base",
    key: "upgrade_type",
    label: "device_update.form.force_upgrade",
    slot: true
  },
  {
    type: "base",
    key: "use_test",
    label: "device_update.form.is_test",
    slot: true
  },
  {
    type: "input",
    key: "version",
    label: "device_update.form.version",
    placeholder: "device_update.form.version_placeholder",
    required: true
  },
  {
    type: "base",
    key: "link",
    label: "device_update.form.upgrade_package",
    slot: true,
    required: true
  },
  {
    type: "input",
    key: "size",
    label: "device_update.form.size",
    defaultValue: "0",
    disabled: true
  },
  {
    type: "input",
    key: "content",
    label: "device_update.form.upgrade_content",
    placeholder: "device_update.form.upgrade_content_placeholder",
    inType: "textarea",
    required: true
  }
];
